package ThreadDemo;

public class ThreadDemo06 {
    public static boolean isQuit=false;
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(){
            @Override
            public void run() {
                while(!isQuit) {
                    System.out.println("别烦我，我正在转账");
                    try {
                        sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("转账操作被终止");
            }
        };
        t.start();
        Thread.sleep(1000);
        System.out.println("对方是内鬼，终止交易！！！");
        isQuit=true;
    }
}
